const config = {
    localhost: {
        baseURL: "http://localhost:8080",
        websocketURL: 'ws://localhost:8080/ws',
        loginURL: ''
    },
    prod: {}
};

const host = location.host;
const env = host.match(/\b(alpha|test|localhost)\b|$/)[0] || 'prod';

export default {
    baseURL() {
        return config[env].baseURL;
    },
    websocketURL() {
        let url = document.location.href;
        if (env === 'localhost') {
            url = config.localhost.websocketURL;
        } else {
            url = 'ws://' + url.split('//')[1].split('/')[0] + '/ws';
        }
        return url;
    },
    env() {
        return env;
    }
};
